package ru.compft.site.spring.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created with IntelliJ IDEA.
 * User: VVasiliev
 * Date: 17.10.12
 * Time: 17:39
 * Тестовый класс - для примера
 */
@Controller
public class MainController {
    public static final String INDEX_PAGE = "/index.do";
    public static final String INDEX_VIEW = "main";

    public static final String INFO_PAGE = "/info.do";
    public static final String INFO_VIEW = "info";

    @RequestMapping(value = INDEX_PAGE)
    public ModelAndView index(Model model) {

        model.addAttribute("message", "Message from main controller to main page!");

        return new ModelAndView(INDEX_VIEW);
    }

    @RequestMapping(value = INFO_PAGE)
    public ModelAndView info(Model model) {

        model.addAttribute("message", "Message from main controller to info page!");

        return new ModelAndView(INFO_VIEW);
    }
}
